/*******************************************************************************
 * Copyright 2011-2012 Dik Grapendaal
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package sh.grapendaal.tsuushin.tracking;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import sh.grapendaal.tsuushin.core.IrcChannel;

public class TrackedChannel extends IrcChannel {
	private Map<String, String> channelModes = new HashMap<String, String>();
	private Map<TrackedUser, List<UserMode>> userModes = new HashMap<TrackedUser, List<UserMode>>();

	public TrackedChannel(String name) {
		this(name, null);
	}

	public TrackedChannel(String name, String password) {
		super(name, password);
	}

	public Map<String, String> getChannelModes() {
		return channelModes;
	}

	public Map<TrackedUser, List<UserMode>> getUserModes() {
		return userModes;
	}

	@Override
	public boolean equals(Object object) {
		if (!(object instanceof TrackedChannel)) {
			return false;
		}
		if (this == object) {
			return true;
		}
		TrackedChannel rhs = (TrackedChannel) object;
		return new EqualsBuilder().appendSuper(super.equals(object)).append(this.channelModes, rhs.channelModes)
				.append(this.userModes, rhs.userModes).isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder().appendSuper(super.hashCode()).append(this.channelModes).append(this.userModes)
				.toHashCode();
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this).appendSuper(super.toString()).append(this.channelModes).append(this.userModes)
				.toString();
	}
}
